package net.knightwatch.kwtools.database;

import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class PhotoAnswerTable {
	private static final String TAG = "PhotoAnswerTable";
	// Database Table
	public static final String TABLE_PHOTO_ANSWERS = "PhotoAnswers";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_ANSWER_ID = "answerId";
	public static final String COLUMN_PHOTO_ANSWER = "photoAnswer";

	// House the photo for a given answer.
	// Database Creation SQL Statement
	private static final String DATABASE_CREATE = "create table " 
			+ TABLE_PHOTO_ANSWERS
			+ "("
			+ COLUMN_ID + " integer primary key autoincrement, "
			+ COLUMN_ANSWER_ID + " integer not null,"
			+ COLUMN_PHOTO_ANSWER + " blob"
			+ ");";
	
	public static void onCreate(SQLiteDatabase database) {
		
		try {
			Log.i(TAG, "Creating " + TABLE_PHOTO_ANSWERS + " Table");
			database.execSQL(DATABASE_CREATE);
		} catch (SQLException e) {
			Log.e(TAG, "Unable to create the table " + TABLE_PHOTO_ANSWERS);
			e.printStackTrace();
		} finally {
			Log.i(TAG, "Table "+TABLE_PHOTO_ANSWERS+" has been created.");
		}
	}
	public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion){
		
	}
}